package main

import (
	"fmt"
	"net"
)

func main()  {
    listener, err := net.Listen("tcp","127.0.0.1:8080")
    if err!=nil{
    	fmt.Println("err:",err)
    	return
	}
    defer listener.Close()

    conn,err1:=listener.Accept()
	if err1!=nil{
		fmt.Println("err1:",err1)
		return
	}
    for{
		buf:=make([]byte,1024)
		num,err2:=conn.Read(buf)
		if err2!=nil{
			fmt.Println("err2:",err2)
			return
		}
		fmt.Println(string(buf[:num]))

	}
}
